//
//  KFDInvestmentCommunityself.m
//  
//
//  Created by JIRENTIANXIANG on 6/26/15.
//
//

#import "KFDInvestmentCommunityPost.h"

@implementation KFDICPostComment

@end

@implementation KFDInvestmentCommunityPost

-(instancetype)initWithDictionary:(NSDictionary *)item
{
    if (self=[super initWithDictionary:item]) {
        self.likes=((NSString*)item[@"likes"]).integerValue;
        self.comments=((NSString*)item[@"comments"]).integerValue;
        self.date=[NSDate dateWithTimeIntervalSince1970:((NSString*)item[@"dateline"]).integerValue];
        NSMutableArray* comments=[NSMutableArray array];
        NSArray* rawComments=item[@"newcomments"];
        if (rawComments&&![rawComments isKindOfClass:[NSNull class]]) {
            for (NSDictionary* commentRaw in rawComments) {
                KFDICPostComment* comment=[KFDICPostComment modelObjectFromDictionary:commentRaw];
                [comments addObject:comment];
            }
            self.newcomments=comments;
        }
    }
    return self;
}

@end
